/**
 * Created by dev-001 on 2017/3/23.
 */
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;

const TeacherClazzSchema = new Schema({
    teacher: {
        type: ObjectId,
        ref: 'User'
    },
    school: {
        type: ObjectId,
        ref: 'School'
    },
    realClazz: [{
        type: ObjectId,
        ref: 'Clazz'
    }],//实体班级
    virtualClazz: [{
        type: ObjectId,
        ref: 'Clazz'
    }],//历年虚拟班级
    status: Boolean,
    createdAt: Date,
    updatedAt: Date
});

TeacherClazzSchema.pre('save', function (next) {
    this.createdAt = new Date();
    next();
});

export default mongoose.model('TeacherClazz', TeacherClazzSchema);